package com.wardrobe.dao.goods;

import com.wardrobe.domain.common.BackEndFromBean;
import com.wardrobe.domain.goods.GoodsBean;
import com.wardrobe.domain.goods.GoodsFromBean;
import com.wardrobe.domain.goods.GoodsShowBean;
import com.wardrobe.mapper.master.goods.GoodsMasterMapper;
import com.wardrobe.mapper.slave.goods.GoodsSlaveMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2018/11/16.
 */
@Service
public class GoodsDao {
    @Autowired
    private GoodsMasterMapper goodsMasterMapper;
    @Autowired
    private GoodsSlaveMapper goodsSlaveMapper;

   public int insertGoods(GoodsBean goodsBean){
        return goodsMasterMapper.insertGoods(goodsBean);
    }

    public int updateGoods(BackEndFromBean fromBean){
        return goodsMasterMapper.updateGoods(fromBean);
    }

    public List<GoodsShowBean> selectGoodsList(GoodsFromBean fromBean){
        return goodsSlaveMapper.selectGoodsList(fromBean);
    }

    public long countGoods(GoodsFromBean fromBean){
        return goodsSlaveMapper.countGoods(fromBean);
    }

    public GoodsShowBean selectGoodsById(long id){
        return goodsSlaveMapper.selectGoodsById(id);
    }

    public List<GoodsShowBean> selectApiGoodsList(){
        return goodsSlaveMapper.selectApiGoodsList();
    }

    public List<GoodsShowBean> selectGoodsListByShopId(long shopId){
        return goodsSlaveMapper.selectGoodsListByShopId(shopId);
    }

    public List<GoodsShowBean> getSearchGoodsList(String goodName){
        return goodsSlaveMapper.getSearchGoodsList(goodName);
    }
}
